package cn.tedu.spring.config;

import cn.tedu.spring.eg1.Product;
import cn.tedu.spring.example.User;
import cn.tedu.spring.file.Database;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestSpringConfig {
    public static void main(String[] args) {
        //创建IoC容器，会有一大堆的Spring Bean对象存入IoC容器中
       ApplicationContext context=new AnnotationConfigApplicationContext(SpringConfig.class);
        Database database = context.getBean(Database.class);
        System.out.println(database);
        Product product = context.getBean(Product.class);
        System.out.println(product);
        User user = context.getBean(User.class);
        user.run();
    }
}
